import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace ConsumptionRecordsApi {
    /** 消费记录信息 */
  export interface ConsumptionRecords {
            id: number; // 主键ID
            handCardId?: number; // 手牌ID
            memberId: number; // 会员ID
            roomNumber: string; // 房间号
            serviceType?: string; // 服务类型
            serviceName?: string; // 服务名称
            quantity?: number; // 数量
            unitPrice?: number; // 单价
            totalAmount?: number; // 总金额
            discountAmount: number; // 优惠金额
            actualAmount?: number; // 实收金额
            technicianId: number; // 技师ID
            consumptionTime?: string | Dayjs; // 消费时间
            status?: string; // 状态
            paymentMethod: string; // 支付方式
            remarks: string; // 备注
      }
}

/** 查询消费记录分页 */
export function getConsumptionRecordsPage(params: PageParam) {
  return requestClient.get<PageResult<ConsumptionRecordsApi.ConsumptionRecords>>('/spa/consumption-records/page', { params });
}

/** 查询消费记录详情 */
export function getConsumptionRecords(id: number) {
  return requestClient.get<ConsumptionRecordsApi.ConsumptionRecords>(`/spa/consumption-records/get?id=${id}`);
}

/** 新增消费记录 */
export function createConsumptionRecords(data: ConsumptionRecordsApi.ConsumptionRecords) {
  return requestClient.post('/spa/consumption-records/create', data);
}

/** 修改消费记录 */
export function updateConsumptionRecords(data: ConsumptionRecordsApi.ConsumptionRecords) {
  return requestClient.put('/spa/consumption-records/update', data);
}

/** 删除消费记录 */
export function deleteConsumptionRecords(id: number) {
  return requestClient.delete(`/spa/consumption-records/delete?id=${id}`);
}

/** 批量删除消费记录 */
export function deleteConsumptionRecordsList(ids: number[]) {
  return requestClient.delete(`/spa/consumption-records/delete-list?ids=${ids.join(',')}`)
}

/** 导出消费记录 */
export function exportConsumptionRecords(params: any) {
  return requestClient.download('/spa/consumption-records/export-excel', params);
}

